Let's have the ball go to a random position on the stage.

  • Click on the Python tab. Then, go to and drag Random Integer into your program.
  • Change the variable name (before the equals sign) to x.
  • Change the numbers to (-100, 150).

This command picks a random x-coordinate between -100 and 150. The coordinate is stored in the variable named x.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)